package com.study.utils;


import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author zhuzi
 * 2025/2/19 下午3:02
 */
@Component
public class EnvironmentUtils implements ApplicationContextAware {
    private static Environment environment;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        environment = applicationContext.getEnvironment();
    }

    public static String getProperty(String key) {
        return environment.getProperty(key);
    }
}
